<?php
require_once('../includes/frameworkajax.php');
if(@!$_GET['term'])
exit;

$term = @$_GET['term'];
$sql = "select ci_profissional, nm_profissional from tethys.tb_profissionais
where nm_profissional ilike '%{$term}%'
order by 2 asc
limit 10";
$query = @Connection::query($sql);
$str = '[';
while($row = $query->fetch()){
	$str .= '{"id":"'.$row['ci_profissional'].'","label":"'.$row['nm_profissional'].'"},';
}
echo substr($str, 0, -1).']';
?>